'use strict';

module.exports = app => {
    const { Sequelize, model } = app

    const Model = model.define('minaMoneyTrace', {
        id:{
            type: Sequelize.STRING.BINARY,
            defaultValue: Sequelize.UUIDV1,
            primaryKey: true
        },
        trade: {
            type: Sequelize.INTEGER(8),
            allowNull: false,
        },
        balance: {
            type: Sequelize.INTEGER(8),
            allowNull: false,
        },
        remark: {
            type: Sequelize.STRING,
            allowNull: false,
        },
    }, {
        freezeTableName: true,
        tableName: 'mina_money_trace',
    })

    Model.associate = function() {
        model.MinaMoneyTrace.belongsTo(model.MinaDriver)
        model.MinaDriver.hasMany(model.MinaMoneyTrace)
    }

    return Model
}